import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-chart-spider',
  templateUrl: './chart-spider.component.html',
  styleUrls: ['./chart-spider.component.css']
})
export class ChartSpiderComponent implements OnInit {

  constructor() { }
  public chartOptions1;
  public chartOptions2;
  ngOnInit() {
  	this.chartOptions1 = {
      chart: {
        polar: true,
        type: 'line'
      },
      title: {
        text: '振动',
        x: 0,
        y: 20
      },
      pane: {
        size: '80%'
      },
      xAxis: {
        categories: ['顶盖X', '顶盖Y', '顶盖垂直', '上机架X', '上机架Y', '上机架垂直', '下机架X', '下机架Y', '下机架垂直', '定子机架X', '定子机架Y', '定子机架垂直'],
        tickmarkPlacement: 'on',
        lineWidth: 0
      },
      yAxis: {
        gridLineInterpolation: 'polygon',
        lineWidth: 0,
        min: 0,
        tickInterval: 0.2
      },
      tooltip: {
        shared: true,
        pointFormat: '<span style="color:{series.color}">{series.name}: <b>${point.y}</b><br/>'
      },
      credits: {
        enabled: false
      },
      series: [{
        name: '标准值',
        data: [1.1, 1.1, 1.2, 1.4, 0.5, 0.7, 0.2, 0.1, 0.5, 0.7, 0.8, 0.9],
        pointPlacement: 'on'
      }, {
        name: '最大值',
        data: [0.4, 0.6, 0.7, 0.1, 0.5, 0.2, 0.3, 0.4, 0.9, 0.8, 0.4, 0.4],
        pointPlacement: 'on'
      }, {
        name: '平均值',
        data:  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
        pointPlacement: 'on'
      }]
    }
    this.chartOptions2 = {
      chart: {
        polar: true,
        type: 'line'
      },
      title: {
        text: '摆度',
        x: 0,
        y: 20
      },
      pane: {
        size: '80%'
      },
      xAxis: {
        categories: ['水导X', '水导Y', '上导X', '上导Y', '下导X', '下导Y'],
        tickmarkPlacement: 'on',
        lineWidth: 0
      },
      yAxis: {
        gridLineInterpolation: 'polygon',
        lineWidth: 0,
        min: 0,
        tickInterval: 0.2
      },
      tooltip: {
        shared: true,
        pointFormat: '<span style="color:{series.color}">{series.name}: <b>${point.y}</b><br/>'
      },
      credits: {
        enabled: false
      },
      series: [{
        name: '标准值',
        data: [1.1, 1.1, 1.2, 1.4, 0.5, 0.7],
        pointPlacement: 'on'
      }, {
        name: '最大值',
        data: [0.4, 0.6, 0.7, 0.1, 0.5, 0.2],
        pointPlacement: 'on'
      }, {
        name: '平均值',
        data:  [1, 1, 1, 1, 1, 1],
        pointPlacement: 'on'
      }]
    }
  }

}
